PLC의 Ladder마찬가지로 ON Delay Timer의 역할을 하는 스크립트를 만들 수 있다.
If ( $DI_0000 == OFF && flag ==0 ) return;
If ( $DI_0000 == ON && flag ==0 ) {
startyear = @GetDateYear();
startmon = @GetDateMon();
startday = @GetDateDay();
starthour = @GetTimeHour();
startmin = @GetTimeMin();
startsec = @GetTimeSec();
startcount=@GetMinCount(startyear, startmon, startday, starthour, startmin);
flag = 1;
}
if ( flag == 1 ){
curryear = @GetDateYear();
currmon = @GetDateMon();
currday = @GetDateDay();
currhour = @GetTimeHour();
currmin = @GetTimeMin();
currsec = @GetTimeSec();
endcount=@GetMinCount(curryear, currmon, currday, currhour, currmin);
hap = endcount – startcount;
if ( currsec >= startsec) {
hap = (hap*60) + (currsec – startsec);
}
else {
hap = (hap*60) + (60-startsec) + endsec;
}
if ( hap >= $SETDEALYTIME ){
$OUTPUT = 1;
flag = 0;
}
}
위와 같이 하면 DI_0000이라는 디지털 입력태그가 한번 ON의 입력신호를 받으면 SETDELAYTIME 이후에 OUTPUT 출력태그로 출력해준다.
OFF DELAY TIMER는 ON 대신에 OFF로 OFF대신에 ON으로 대체하면 된다.